<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 
        onfocus 获取焦点
        onblur  失去焦点
     -->
    <input id="app" type="text">
    <script>
        var app = document.getElementById("app")
        app.onfocus = function(){
            this.style.backgroundColor="red"
        }
        app.onblur = function(){
            this.style.backgroundColor = "yellow"
        }
    </script>
</body>
</html>